package com.erlinyou.im.web.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 用于推送的系统消息
 * @author Administrator
 *
 */
@ApiModel(value = "SysMessageVo",description = "系统推送消息")
public class SysMessageVo <T>{
	public enum SysMessageVoType{
		MESSAGE_REVOKE(1);//消息撤回
		private int code;
		SysMessageVoType(int code){
			this.code = code;
		};
		public int getCode() {
			return code;
		}
	}
	/**
	 * 撤回消息
	 * @author Administrator
	 *
	 */
	@ApiModel(value = "RevokeMessage",description = "用户撤回消息")
	public static class RevokeMessage{
		@ApiModelProperty(notes = "撤回人", required = true)
		private Long rid;
		@ApiModelProperty(notes = "消息ID", required = true)
		private String msgid;
		public Long getRid() {
			return rid;
		}
		public void setRid(Long rid) {
			this.rid = rid;
		}
		public String getMsgid() {
			return msgid;
		}
		public void setMsgid(String msgid) {
			this.msgid = msgid;
		}
		
	}
	@ApiModelProperty(notes = "推送消息ID", required = true)
	private String id;
	/**
	 * 1	消息撤回
	 */
	@ApiModelProperty(notes = "消息类型", required = true)
	private int type;
	@ApiModelProperty(notes = "推送时间", required = true)
	private long createTime;
	@ApiModelProperty(notes = "消息内容", required = true)
	private T content;
	public SysMessageVo(String id, long createTime, T content) {
		super();
		this.id = id;
		if(content instanceof RevokeMessage){
			this.type = SysMessageVoType.MESSAGE_REVOKE.code;
		}else{
			throw new RuntimeException("未知消息");
		}
		this.createTime = createTime;
		this.content = content;
	}
	public long getCreateTime() {
		return createTime;
	}
	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}
	public T getContent() {
		return content;
	}
	public void setContent(T content) {
		this.content = content;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	
}
